Skip to content

Interface for swapping inputs and outputs based on cost model + working permute example (#18929)#18929

Open
DrJessop wants to merge 2 commits intopytorch:mainfrom
DrJessop:export-D100917820
Open

Interface for swapping inputs and outputs based on cost model + working permute example (#18929)#18929
DrJessop wants to merge 2 commits intopytorch:mainfrom
DrJessop:export-D100917820

Conversation

@DrJessop
Copy link
Copy Markdown
Contributor

@DrJessop DrJessop commented Apr 16, 2026

Summary:

I have seen the following pattern quite a bit so far where we have

wrapper(x0), wrapper(x1), x2 -> op -> wrapper(o0), o1

for example, and it is semantically equivalent to instead run
x0, x1, wrapper(x2) -> op -> o0, wrapper(o1)

In case 1, we had 3 wrapper ops, and in case 2, we have 2, so it's better to run 2. This interface formalizes this idea. I also implemented the pass which uses this interface for the permute case.

What is really nice about this interface is that in a single pass, we can do a LOT of cleanup. See the docs in the diff for a case for adds.

Differential Revision: D100917820

@pytorch-bot
Copy link
Copy Markdown

pytorch-bot bot commented Apr 16, 2026

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/18929

Note: Links to docs will display an error until the docs builds have been completed.

❗ 1 Active SEVs

There are 1 currently active SEVs. If your PR is affected, please view them below:

❌ 1 New Failure, 1 Cancelled Job, 2 Unrelated Failures

As of commit f65b936 with merge base a489707 (image):

NEW FAILURE - The following job has failed:

CANCELLED JOB - The following job was cancelled. Please retry:

BROKEN TRUNK - The following jobs failed but were present on the merge base:

👉 Rebase onto the `viable/strict` branch to avoid these failures

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@meta-cla meta-cla bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Apr 16, 2026
@meta-codesync
Copy link
Copy Markdown
Contributor

meta-codesync bot commented Apr 16, 2026

@DrJessop has exported this pull request. If you are a Meta employee, you can view the originating Diff in D100917820.

@github-actions
Copy link
Copy Markdown

This PR needs a release notes: label

If your change should be included in the release notes (i.e. would users of this library care about this change?), please use a label starting with release notes:. This helps us keep track and include your important work in the next release notes.

To add a label, you can comment to pytorchbot, for example
@pytorchbot label "release notes: none"

For more information, see
https://github.com/pytorch/pytorch/wiki/PyTorch-AutoLabel-Bot#why-categorize-for-release-notes-and-how-does-it-work.

Andrew Grebenisan added 2 commits April 16, 2026 12:04
Summary:

- Adds support to run to run passes on ExportedPrograms and EdgeProgramManager
- EdgeProgramManager transform behaves basically like a pass manager

Reviewed By: larryliu0820, ethansfng

Differential Revision: D91725222
…ng permute example (pytorch#18929)

Summary:

I have seen the following pattern quite a bit so far where we have

wrapper(x0), wrapper(x1), x2 -> op -> wrapper(o0), o1

for example, and it is semantically equivalent to instead run
x0, x1, wrapper(x2) -> op -> o0, wrapper(o1)

In case 1, we had 3 wrapper ops, and in case 2, we have 2, so it's better to run 2. This interface formalizes this idea. I also implemented the pass which uses this interface for the permute case.

What is really nice about this interface is that in a single pass, we can do a LOT of cleanup. See the docs in the diff for a case for adds.

Differential Revision: D100917820
@meta-codesync meta-codesync bot changed the title Interface for swapping inputs and outputs based on cost model + working permute example Interface for swapping inputs and outputs based on cost model + working permute example (#18929) Apr 16, 2026
@DrJessop DrJessop force-pushed the export-D100917820 branch from c5916b3 to c231967 Compare April 16, 2026 19:04
DrJessop pushed a commit to DrJessop/executorch that referenced this pull request Apr 16, 2026
…ng permute example (pytorch#18929)

Summary:

I have seen the following pattern quite a bit so far where we have

wrapper(x0), wrapper(x1), x2 -> op -> wrapper(o0), o1

for example, and it is semantically equivalent to instead run
x0, x1, wrapper(x2) -> op -> o0, wrapper(o1)

In case 1, we had 3 wrapper ops, and in case 2, we have 2, so it's better to run 2. This interface formalizes this idea. I also implemented the pass which uses this interface for the permute case.

What is really nice about this interface is that in a single pass, we can do a LOT of cleanup. See the docs in the diff for a case for adds.

Differential Revision: D100917820
@DrJessop DrJessop force-pushed the export-D100917820 branch from c231967 to f65b936 Compare April 16, 2026 19:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. fb-exported meta-exported

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant